/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.hutech09.jsale.bsn;

import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import org.hutech09.jsale.bsn.exception.ItemNotFoundException;
import org.hutech09.jsale.entity.InfoType;
import org.hutech09.jsale.entity.Price;
import org.hutech09.jsale.entity.Product;
import org.hutech09.jsale.entity.ProductDetail;
import org.hutech09.jsale.entity.ProductImage;

/**
 *
 * @author Nam
 */
@Local
public interface IProductManager {

    public Product create(Product pro);

    public void update(Product pro) throws ItemNotFoundException;

    long countProduct();

    public long countProduct(Map<String, Object> filter);

    public List<Product> findProductPage(int firstIndex, int pageSize, String orderField, boolean desc, Map<String, Object> filter);

    public Product findProductById(long id);
    
    public List<Product> findProductByName(String name);
    
    public List<Product> getNewProduct();

    /*=======================PRICE============================*/
    public List<Price> getPrices(long productId) throws ItemNotFoundException;

    public Price findPriceById(long priceId);

    public Price addPrice(Price price);

    public void updatePrice(Price price) throws ItemNotFoundException;

    public void deletePrice(long priceId) throws ItemNotFoundException;

    public List<Price> findPricePage(int firstIndex, int pageSize, String orderField, boolean desc, Map<String, Object> filter);

    public long countPrice(Map<String, Object> filter);

    /*=======================IMAGE============================*/
    public ProductImage addImage(ProductImage image);

    public void deleteImage(long imageId) throws ItemNotFoundException;

    public List<String> getImagePaths(long productId) throws ItemNotFoundException;

    public List<ProductImage> getProductImages(long productId) throws ItemNotFoundException;

    public ProductImage updateImage(ProductImage image) throws ItemNotFoundException;

    /*=======================Detail============================*/
    public InfoType getInfoType(long id);

    public InfoType createInfoType(InfoType infoType);

    public void updateInfoType(InfoType infoType);

    public List<InfoType> getAllInfoType();
    
    public List<InfoType> findListInfoType(String name);
    
    public InfoType findInfoType(String name);

    public void deleteInfoType(long id) throws ItemNotFoundException;

    public List<ProductDetail> getDetail(long productId) throws ItemNotFoundException;

    public ProductDetail addDetail(ProductDetail detail);
    
    public void updateProductDetail(ProductDetail detail) throws ItemNotFoundException;

    public void deleteProductDetail(ProductDetail detail) throws ItemNotFoundException;
}
